<template>
  <el-form
    ref="elFormRef"
    label-width="auto"
    label-position="top"
    :rules="rules"
    :model="formData"
  >
    <el-form-item prop="name" label="节点名称">
      <el-input
        v-model="formData.name"
        placeholder="请填写节点名称"
      />
    </el-form-item>
  </el-form>
</template>
<script>
export default {
  name: '',
  props: {
    formData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      rules: {
        name: [{ required: true, message: '节点名称不能为空', trigger: ['change', 'blur'] }]
      }
    }
  },
  methods: {
    validateForm() {
      return new Promise(resolve => {
        this.$refs.elFormRef.validate(flag => {
          if (!flag) resolve(false)

          resolve(true)
        })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
